<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends CI_Controller {



    public function index() {
        $this->load->library('session');
        
        
        if ($this->verificaLogado()) {
            
            $array['tpcli'] = $this->session->userdata['tpcli'];
            $array['nome'] = $this->session->userdata['nome'];
            $this->load->view('member/home', $array);
        } else {
            redirect(base_url());
        }
        
    }

    private function verificaLogado() {
        if (isset($this->session->userdata['logado_crf']) && $this->session->userdata['logado_crf'])
            return true;

        return false;
    }
    
    
    public function logoff(){
        
        $data= array(
            'id_usuario' => null,
            'nome' =>       null,
            'logado_crf' =>     false
        );

        $this->session->set_userdata($data);
        
        
        
        redirect(base_url());
        
    }


}

/* End of file welcome.php */
/* Location: ./application/controllers/login.php */